home *** CD-ROM | disk | FTP | other *** search
/ CD Actual Thematic 7: Programming / CDAT7.iso / demos / VisualAge for Java 2.0 Entry / setup / data1.cab / ide-e / IDE / cache / SLHVWH (.txt) < prev    next >
Encoding:
Java Class File  |  1998-09-16  |  2.1 KB  |  70 lines

  1. package com.sun.java.swing.plaf;
  2.  
  3. import com.sun.java.swing.BorderFactory;
  4. import com.sun.java.swing.border.Border;
  5. import com.sun.java.swing.border.LineBorder;
  6. import java.awt.Component;
  7. import java.awt.Graphics;
  8. import java.awt.Insets;
  9. import java.io.Serializable;
  10.  
  11. public class BorderUIResource implements Border, UIResource, Serializable {
  12.    static BorderUIResource etched;
  13.    static BorderUIResource loweredBevel;
  14.    static BorderUIResource raisedBevel;
  15.    static BorderUIResource blackLine;
  16.    private Border delegate;
  17.  
  18.    public BorderUIResource(Border delegate) {
  19.       if (delegate == null) {
  20.          throw new IllegalArgumentException("null border delegate argument");
  21.       } else {
  22.          this.delegate = delegate;
  23.       }
  24.    }
  25.  
  26.    public static BorderUIResource getBlackLineBorderUIResource() {
  27.       if (blackLine == null) {
  28.          blackLine = new BorderUIResource(LineBorder.createBlackLineBorder());
  29.       }
  30.  
  31.       return blackLine;
  32.    }
  33.  
  34.    public Insets getBorderInsets(Component c) {
  35.       return this.delegate.getBorderInsets(c);
  36.    }
  37.  
  38.    public static BorderUIResource getEtchedBorderUIResource() {
  39.       if (etched == null) {
  40.          etched = new BorderUIResource(BorderFactory.createEtchedBorder());
  41.       }
  42.  
  43.       return etched;
  44.    }
  45.  
  46.    public static BorderUIResource getLoweredBevelBorderUIResource() {
  47.       if (loweredBevel == null) {
  48.          loweredBevel = new BorderUIResource(BorderFactory.createLoweredBevelBorder());
  49.       }
  50.  
  51.       return loweredBevel;
  52.    }
  53.  
  54.    public static BorderUIResource getRaisedBevelBorderUIResource() {
  55.       if (raisedBevel == null) {
  56.          raisedBevel = new BorderUIResource(BorderFactory.createRaisedBevelBorder());
  57.       }
  58.  
  59.       return raisedBevel;
  60.    }
  61.  
  62.    public boolean isBorderOpaque() {
  63.       return this.delegate.isBorderOpaque();
  64.    }
  65.  
  66.    public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
  67.       this.delegate.paintBorder(c, g, x, y, width, height);
  68.    }
  69. }
  70.